﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using AssessmentTool.PresentationLogic;

namespace AssessmentTool
{
    public enum ModalType
    {
        YESNO,
        CONTINUE
    };

    public partial class ModalWindow : ChildWindow
    {
        private String evento;
        private EventArgs args;
        public ModalWindow()
        {
            InitializeComponent();
        }

        public void Show(String titolo,String test,ModalType type,String evento,EventArgs args)
        {
            this.evento = evento;
            this.args = args;
            this.Show(titolo,test,type);
        }
        public void Show(String titolo,String testo,ModalType type)
        {

            if (type == ModalType.CONTINUE)
            {
                OKCancelCommands.Visibility = Visibility.Collapsed;
                HasCloseButton = true;
            }
            else
            {
                OKCancelCommands.Visibility = Visibility.Visible;
                HasCloseButton = false;
            }
            this.Titolo.Text = titolo;
            this.Testo.Text = testo;

            base.Show();
            
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {

            this.DialogResult = true;
            
            EventDispatcher.getInstance().dispatch(evento, args);        
        }


        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            
        }
    }
}

